<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>测试</title>
    <script type="text/javascript">
    //判断是否为android端访问
function _IsAndroid() {
    if (/(Android|Adr)/i.test(navigator.userAgent)) {
        return true;
    } else {
        return false;
    }
}

//判断是否为ios端访问
function _IsIOS() {
    if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
        return true;
    } else {
        return false;
    }
}


        function loginAction(){
            //alert("start!");
          if (_IsIOS()) {
           window.webkit.messageHandlers.loginAction.postMessage(null);
	            }
	       else if(_IsAndroid()){
              window.loginActionAndroid.postMessage(null)
            }
        }
    </script>
</head>
<body>
<br/>
<button onclick="loginAction()">test</button>
</body>
</html>